* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

/* 按钮 */
.magic {
    position: fixed;
    top: 20px;
    padding: 12px 20px;
    font-size: 16px;
    letter-spacing: 1px;
    color: #fff;
    background-color: #c2e9fb;
    border: 0;
    border-radius: 3px;
    box-shadow: 1px 3px lightgray;
    cursor: pointer;
    z-index: 100;
}

.magic:focus {
    outline: none;
}

/* 有意思:模拟按钮按下去的效果:先做一个盒子阴影,按下去时,去掉阴影,再在Y轴下移2px */
.magic:active {
    box-shadow: none;
    transform: translateY(2px);
}

/* 大盒子容器 */
.boxes {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    width: 500px;
    height: 500px;
    transition: .4s ease;
}

/* 16个盒子时 */
.boxes.big {
    width: 600px;
    height: 600px;
}

/* 16个小盒子时的小盒子 */
.boxes.big .box {
    /* 小盒子图片,顺时针翻滚360度 */
    transform: rotateZ(360deg);
}

/* 1/16之一的小盒子 */
.box {
    position: relative;
    /* 宽高==母盒子600/4 */
    width: 125px;
    height: 125px;
    background-image: url('https://tse1-mm.cn.bing.net/th/id/R-C.23a1857742848995cc5059d1d590dd52?rik=QF%2ff%2fWGJzNHIZg&riu=http%3a%2f%2fimg95.699pic.com%2fphoto%2f40141%2f4969.gif_wh860.gif&ehk=flLJVtsD%2bDpRCzQMjF78wRq0vKwlNzLvrPt%2buWUlZNc%3d&risl=&pid=ImgRaw&r=0');
    background-repeat: no-repeat;
    background-size: 500px 500px;
    transition: .4s ease;
}

/* 小盒子下阴影 */
.box::before {
    content: '';
    position: absolute;
    left: 8px;
    bottom: -15px;
    width: 100%;
    height: 15px;
    background-color: #a1c4fd;
    transform: skewX(45deg);
}

/* 小盒子右阴影 */
.box::after {
    content: '';
    position: absolute;
    top: 8px;
    right: -15px;
    width: 15px;
    height: 100%;
    background-color: #c2e9fb;
    transform: skewY(45deg);
}